#define DEBUG
#include <cstdio>
#include <cmath>
#define MODS 1000000007
#define MAXN 100000
#define MAXC 1000

using namespace std;

long long fact[2*MAXN+1], unfact[2*MAXN+1];

long long qpower(long long a, int n) {
  long long s=1;
  for (; n>1; n>>=1) {
    if (n&1) {
      s = s*a%MODS;
    }
    a = a*a%MODS;
  }
  return s*a%MODS;
}

void sort(int *x, int *y, int l, int r) {
  int i=l, j=r, midx = x[(l+r)/2], midy = y[(l+r)/2], temp;
  for (; i<=j; ) {
    for (; x[j]>midx || (x[j]==midx && y[j]>midy); j--);
    for (; x[i]<midx || (x[i]==midx && y[i]<midy); i++);
    if (i<=j) {
      temp=x[i], x[i]=x[j], x[j]=temp;
      temp=y[i], y[i]=y[j], y[j]=temp;
      i++, j--;
    }
  }
  if (i<r) {
    sort(x, y, i, r);
  }
  if (j>l) {
    sort(x, y, l, j);
  }
}

void initFact(int n) {
  fact[0] = 1;
  for (int i=1; i<=n; i++) {
    fact[i] = fact[i-1]*i%MODS;
  }
  unfact[n] = qpower(fact[n], MODS-2);
  for (int i=n; i>=1; i--) {
    unfact[i-1] = unfact[i]*i%MODS;
  }
}

long long calcC(long long n, long long m) {
  return fact[m]*unfact[n]%MODS*unfact[m-n]%MODS;
}

long long calcDis(int x1, int y1, int x2, int y2) {
  //(x2)(y2)->(y2-1)(x2+1)
  long long ret=calcC(y2-y1, x2-x1+y2-y1);
  return y2-1>=x1 && x2+1>=y1 ? (ret+MODS-calcC(x2+1-y1, y2-1-x1+x2+1-y1))%MODS : ret;
}

int main() {
#ifdef DEBUG
  freopen("4236.in", "r", stdin);
  freopen("4236.out", "w", stdout);
#endif

  static int x[MAXC+1], y[MAXC+1];
  static long long f[MAXC+2];
  int n, c;
  scanf("%d %d", &n, &c);
  initFact(n*2);
  for (int i=1; i<=c; i++) {
    scanf("%d %d", x+i, y+i);
  }
  x[c+1] = y[c+1] = n;
  sort(x, y, 1, c+1);

  for (int i=1; i<=c+1; i++) {
    f[i] = calcDis(0, 0, x[i], y[i]);
    for (int j=i-1; j>0; j--) {
      if (x[i]>=x[j] && y[i]>=y[j]) {
	f[i] = (f[i]+MODS-f[j]*calcDis(x[j], y[j], x[i], y[i])%MODS)%MODS;
      }
    }
  }
  printf("%lld", f[c+1]);

  fcloseall();
  return 0;
}
